<%@page import="java.util.List"%>
<%@page import="com.jfinal.plugin.activerecord.Page"%>
<%@page import="com.hongye.app.model.ContentModel"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" isELIgnored="false"
    pageEncoding="UTF-8"%>
<%  ContentModel content=(ContentModel)request.getAttribute("content"); %>
<!doctype html>
<html class="fixed">
	<head>
		<!-- Basic -->
		<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta name="keywords" content="HTML5 Admin Template" />
		<meta name="description" content="Porto Admin - Responsive HTML5 Template">
		<meta name="author" content="okler.net">
		<!-- Mobile Metas -->
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<!-- Vendor CSS -->
		<link rel="stylesheet" href="../admin/css/bootstrap.css" />
		<link rel="stylesheet" href="../admin/css/font-awesome/css/font-awesome.css" />
        <link rel="stylesheet" href="../admin/css/select2.css" />
		<!-- Theme CSS -->
		<link rel="stylesheet" href="../admin/css/theme.css" />
		<!-- Skin CSS -->
		<link rel="stylesheet" href="../admin/css/default.css" />
		<!-- Theme Custom CSS -->
		<!-- Theme Custom ../admin/css -->
		<script src="../admin/js/modernizr.js"></script>
		<script type="text/javascript" src="http://cdn.bootcss.com/ckeditor/4.5.11/ckeditor.js"></script>
		<style>
		.m{ width: 800px;  margin: 5px;}
		
		</style>
	</head>
	<body >
		<section role="main" class="content-body" style="margin-top: 50px;">
			<!-- start: page -->
			<section class="panel">
				<header class="panel-heading">
					<h2 class="panel-title">公告修改-详情</h2>
				</header>
				<div class="panel-body">
					<div class="panel-body">
						<p>类&nbsp;&nbsp;&nbsp;型：<input id="type" type="text" name="type" value="<%int type=content.getInt("type"); 
											if(type == 0){out.println("用户须知");
											}else if(type == 1){out.println("法律声明");
											}else if(type == 2){out.println("店铺说明");} %>" readonly="true" /></p>
						<p>状&nbsp;&nbsp;&nbsp;态：
							<input type="radio" name="status" value="0" checked="<%int status_1=content.getInt("status"); if(status_1 == 0){out.println("true");} %>" />禁用
							<input type="radio" name="status" value="1" checked="<%int status_2=content.getInt("status"); if(status_2 == 1){out.println("true");} %>"/>启用</p>
						<p>标&nbsp;&nbsp;&nbsp;题：<input id="title" type="text" name="title" value="<%=content.getStr("title")%>" /></p>
						<p>摘要内容：</p><textarea id="summary" cols="100" rows="5" name="summary"  ><%=content.getStr("summary")%></textarea>
						<p>内&nbsp;&nbsp;&nbsp;容：</p>
						<div class="m">
							<textarea id="content" rows="25" cols="100" name="content" value=""><%=content.getStr("content")%></textarea>
							<script type="text/javascript">CKEDITOR.replace('content');</script>
						</div>
						<a  class="btn btn-facebook mb-md ml-xs mr-xs" onclick="editcontent();" >提交修改 </a>
             		 	<a  href="../content/contentView" class="btn btn-facebook mb-md ml-xs mr-xs" onclick="addmenuhid();">取消</a>
					</div>
				</div>
			</section>
		<!-- Specific Page Vendor -->
		<!-- Vendor -->
		<script src="../admin/js/jquery.js"></script>
		<script src="../admin/js/layer.js"></script>
		<!-- Theme Base, Components and Settings -->
		<script src="../admin/js/theme.js"></script>
		<!-- Theme Custom -->
		<script src="../admin/js/theme.custom.js"></script>
		<!-- Theme Initialization Files -->
		<script src="../admin/js/theme.init.js"></script>
		<!-- Examples -->
		<script src="../admin/js/tables/examples.datatables.default.js"></script>
		<script src="../admin/js/tables/examples.datatables.row.with.details.js"></script>
		<script src="../admin/js/tables/examples.datatables.tabletools.js"></script>
		<script type="text/javascript">
		//修改
		function editcontent(){
			layer.confirm('确定修改吗？', {icon: 3, title:'提示'}, function(index){
				var id = ${id};
				var title = $("#title").val();
				var summary = $("#summary").val();
				var content = CKEDITOR.instances.content.getData();
				var status = $('input[name="status"]:checked').val();
				$.post('../content/updateContent',
			            {id:id,title:title,summary:summary,content:content,status:status}
						,function(data){
					if(data=='suc'){
						location.href='../content/contentView';
					}else if(data=='fal'){
						alert('更新失败!');
					}
				});
				  layer.close(index);
			});
		}
		</script>
	</body>

</html>